app.controller('noticePageCtrl',
    function($ionicBackdrop, $rootScope,$interval,$myconfig, $http,$scope, $state, $ionicSideMenuDelegate, $ionicHistory, $ionicPopup, BthSevice, PopupService) {

    //获取本地储存
    $scope.noticeLIST = JSON.parse(localStorage.getItem('noticeLIST'))


    $scope.slideOpen = false; //是否打开侧边栏
    $scope.toggleLeft = function() {
        $ionicSideMenuDelegate.toggleLeft();
        $scope.slideOpen = true;
        var timer = $interval(function () { // 设置个定时器判断侧边栏是否打开，如果是关闭状态则隐藏黑色透明蒙层  *#*#2846579#*#*
            if(!$ionicSideMenuDelegate.isOpen()){
                $scope.slideOpen = false;
                $interval.cancel(timer);
            }
        }, 200);
    };



    //已读
    $scope.onRead = function(index){
        // console.log($scope.noticeLIST);
        $scope.noticeLIST[index].read = 1;
        localStorage.setItem('noticeLIST',JSON.stringify($scope.noticeLIST));
        $scope.noticeLIST = JSON.parse(localStorage.getItem('noticeLIST'));
    };


    //删除通知记录
    $scope.delNOT = function(index){
        $scope.noticeLIST.splice(index,1);
        localStorage.setItem('noticeLIST',JSON.stringify($scope.noticeLIST));
        $scope.noticeLIST = JSON.parse(localStorage.getItem('noticeLIST'));
    };



});
